<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on April 16, 2009 at 3:24:49 pm</time-stamp>


<class>
<name>RetailerSellPolicyDialog</name>
<environment>SupplyChain</environment>
<super>UI.SimpleDialog</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>policiesAspect </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category></category>
<attributes>
<package>SupplyChain</package>
</attributes>
</class>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<methods>
<class-id>SupplyChain.RetailerSellPolicyDialog class</class-id> <category>interface specs</category>

<body package="SupplyChain" selector="windowSpec">windowSpec
	"Tools.UIPainter new openOnClass: self andSelector: #windowSpec"

	&lt;resource: #canvas&gt;
	^#(#{UI.FullSpec} 
		#window: 
		#(#{UI.WindowSpec} 
			#properties: #(#{UI.PropertyListDictionary} #openType #userPlacement ) 
			#label: 'Retailer Sell Policy GUI' 
			#min: #(#{Core.Point} 20 20 ) 
			#max: #(#{Core.Point} 0 0 ) 
			#bounds: #(#{Graphics.Rectangle} 640 512 950 692 ) ) 
		#component: 
		#(#{UI.SpecCollection} 
			#collection: #(
				#(#{UI.SequenceViewSpec} 
					#layout: #(#{Graphics.Rectangle} 12 33 295 136 ) 
					#name: #List1 
					#model: #policiesAspect 
					#useModifierKeys: true 
					#selectionType: #highlight ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 12 6 ) 
					#name: #Label1 
					#label: 'Select a sell policy' ) 
				#(#{UI.ActionButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 52 149 133 172 ) 
					#name: #ActionButton1 
					#model: #accept 
					#label: 'Ch&amp;ange' 
					#defaultable: true ) 
				#(#{UI.ActionButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 165 151 246 174 ) 
					#name: #ActionButton2 
					#model: #cancel 
					#label: '&amp;Cancel' 
					#defaultable: true ) ) ) )</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerSellPolicyDialog class</class-id> <category>creating </category>

<body package="SupplyChain" selector="showGetSellPolicy:">showGetSellPolicy: aSellPolicy
	"I open a new window and select a given SellPolicy.  You can click on my buttons to select a new SellPolicy.  If you click Change, I will return the SellPolicy class
	you selected.  If you click Cancel, I will be very sad but I will return the SellPolicy class that you originally passed as a parameter."
	
	| window |
	window := self new initialize.
	window policy: aSellPolicy.
	^window open
		ifTrue: [ ^window policy. ]
		ifFalse: [ ^aSellPolicy. ]</body>
</methods>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<comment>
<class-id>SupplyChain.RetailerSellPolicyDialog</class-id>
<body>I am a dialog for displaying and changing the sell policies or the retailer.

Not really Instance Variables:
	policy &lt;SellPolicy class&gt;	Gets or sets the SellPolicy that is/was selected.</body>
</comment>

<methods>
<class-id>SupplyChain.RetailerSellPolicyDialog</class-id> <category>aspects</category>

<body package="SupplyChain" selector="policiesAspect">policiesAspect
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^policiesAspect isNil
		ifTrue:
			[policiesAspect := SelectionInList new]
		ifFalse:
			[policiesAspect]</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerSellPolicyDialog</class-id> <category>initialize-release</category>

<body package="SupplyChain" selector="initialize">initialize
	"Initialize a newly created instance. This method must answer the receiver."
	
	| policies |
	policies := OrderedCollection new.
	policies add: CheapestItemFirstPolicy.
	policies add: EarliestItemFirstPolicy.
	policies add: ExpensiveItemFirstPolicy.
	policies add: LastItemFirstPolicy.
	super initialize.
	(policiesAspect := SelectionInList new) listHolder: (UI.ValueHolder with: policies).
	^self</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerSellPolicyDialog</class-id> <category>accessing</category>

<body package="SupplyChain" selector="policy">"I get the currently selected policy."

policy
	^policiesAspect selection.</body>

<body package="SupplyChain" selector="policy:">"I set the currently selected policy."

policy: aSellPolicy
	policiesAspect selection: aSellPolicy</body>
</methods>

</st-source>
